package cheme.ProcessEditor.Parts;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;

public class AnimationThread extends Thread
{
	IFigure figurePart = null;
	public void run() 
	{
		long currentTimeInSeconds = System.currentTimeMillis()/1000;
		int color = 0;
		long loopLimit = currentTimeInSeconds + 10 ;
		for(long i= currentTimeInSeconds; i < loopLimit ; i= (System.currentTimeMillis()/1000))
		{
			if(color == 0)
			{
				figurePart.setForegroundColor(ColorConstants.blue);				
				color = 1;
			}
			else
			{
				figurePart.setForegroundColor(ColorConstants.red);
				color = 0;
			}
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
    }
	
	public void setObject(IFigure figureObj)
	{
		figurePart = figureObj;
	}
	
	

}
